package com.umeox.watch.moto.dataservice.db.dao;


import android.database.Cursor;

import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;

import com.umeox.watch.moto.dataservice.db.model.DeviceConfig;


@Dao
public interface DeviceDao {

    @Query("SELECT * FROM device_config WHERE deviceId = :deviceId")
    DeviceConfig queryByDeviceId(String deviceId);

    @Query("SELECT * FROM device_config WHERE deviceId = :deviceId LIMIT 1")
    Cursor query(String deviceId);

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    long save(DeviceConfig config);

    @Delete
    void delete(DeviceConfig config);

    @Query("DELETE FROM device_config")
    void deleteAll();

}
